package com.sto.stoapp.adapter;

import java.util.List;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.sto.stoapp.activity.R;
import com.sto.stoapp.entity.InquiryEntity;

/**
 * 显示记录查询功能项适配器
 * 
 * @author Administrator
 * 
 */
@SuppressLint("SimpleDateFormat")
public class InquiryMenuAdapter extends BaseAdapter {

	private Context context;
	private List<InquiryEntity> menuList;

	/**
	 * 构造函数
	 * 
	 * @param context
	 * @param courierList
	 */
	public InquiryMenuAdapter(Context context, List<InquiryEntity> list) {
		this.context = context;
		this.menuList = list;

	}

	@Override
	public int getCount() {
		return menuList == null ? 0 : menuList.size();

	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {

		return 0;
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {

		final Holder holder;
		if (view == null) {
			holder = new Holder();
			view = LayoutInflater.from(context).inflate(
					R.layout.sto_inquiry_item, null);
			holder.textmenu = (TextView) view.findViewById(R.id.textMenu);
			holder.imagebutton = (ImageView) view.findViewById(R.id.imageMenu);
			view.setTag(holder);

		} else {
			holder = (Holder) view.getTag();
		}
		holder.textmenu.setText(menuList.get(position).getMenuName());
		holder.imagebutton
				.setImageResource(menuList.get(position).getImageId());
		return view;
	}

	class Holder {
		TextView textmenu;
		ImageView imagebutton;
	}

}
